#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main()
{
	int count1 = 0;
	int a = 0;
	for(a = 123;a != 0;a >>= 1)
	{
		if (a < 0)
		{
			count1++;
			a = -a;
		}
		if (a % 2 == 1)//还可以改成：a & 0 == 1 或 a | -2 == -1
			count1++;
	}
	printf("%d", count1);
}